package com.devsoft.foodfrenzy;

import org.andengine.engine.camera.Camera;
import org.andengine.entity.primitive.Rectangle;
import org.andengine.entity.sprite.Sprite;
import org.andengine.input.touch.TouchEvent;
import org.andengine.opengl.util.GLState;
import org.andengine.util.adt.color.Color;

import com.devsoft.foodfrenzy.SceneManager.SceneType;

public class CreditsScene extends BaseScene{
	
	@Override
	public void createScene() 
	{
		createBackground();
		
		final Rectangle screen = new Rectangle(400, 320, 165, 30, vbom)	//camera at center, rectangle is inverted?
        {
            public boolean onAreaTouched(TouchEvent touchEvent, float X, float Y)
            {
            	if (touchEvent.isActionDown())
            	{
                	UserData.getInstance().cheatMode();
                }
                return true;
            };
        };
        screen.setVisible(false);
        registerTouchArea(screen);
        attachChild(screen);
	}
	
	private void createBackground()
	{
		attachChild(new Sprite(400, 240, resourcesManager.credits_background_region, vbom)
    	{
    	    @Override
    	    protected void preDraw(GLState pGLState, Camera pCamera)	//probably wont need dither
    	    {
    	       super.preDraw(pGLState, pCamera);
    	       pGLState.enableDither();
    	       
    	    }
    	    
    	});        
	}

	@Override
	public void onBackKeyPressed() 	//exit app when backed
	{
		SceneManager.getInstance().loadMenuScene(engine, this.getSceneType());
	}
	

	@Override
	public SceneType getSceneType()
	{
	    return SceneType.SCENE_CREDITS;
	}
	
	
	@Override
	public void disposeScene() 
	{
		this.detachSelf();
        this.dispose();
	}

}